
//
//  NavigationView.swift
//  Bocai
//
//  Created by GujyHy on 2017/11/7.
//  Copyright © 2017年 GujyHy. All rights reserved.
//

import UIKit

extension UINavigationController {
    
     func ex_pushViewController(_ viewController: UIViewController, animated: Bool) {
        viewController.hidesBottomBarWhenPushed = true
        self.pushViewController(viewController, animated: animated)
        if  self.childViewControllers.count > 1 {
            let image = UIImage(named: "ic_navibar_back_white")!
            let leftBarItem = UIBarButtonItem(image: image, target: self, action: #selector(popSelf))
            viewController.navigationItem.leftBarButtonItem = leftBarItem
        }
    }
    
    @objc func popSelf(){
        self.popViewController(animated: true)
    }
    
}
